Text handling functions

selectText(long selBegin, long selEnd, int options) selBegin is the logical character position of the first character in the selection selEnd is the logical character position of the last character in the selection options is 0 for select only; 1 for select and show the selection in the window; 2 for select and delete the selected characters

getSelectionInfo(int *selMode, int *selWindow, long *selBegin, long *selEnd) selMode returns the selection mode selWindow returns the windowId of the window containing the selection selBegin is the logical byte position in the file of the first byte of the selection selEnd is the logical byte position in the file of the last byte of the selection

(int)n = setSelectionInfo(int windowId, int selMode) windowId is the id of the new selection window selMode is the new selection mode n is 1 if the windowId was invalid and is 0 otherwise

insertString(int length, int stringOffset, int stringSegment, hidden) This call serves two separate functions. The first is to provide a faster and easier way to insert a string of characters into a file. It is used in place of a sequence of ``insertCharacter'' calls. For this purpose use hidden=0. The second function of this call is to insert ``text marks'' into the file. A text mark is a hidden marker in the text. It has a string associated with it but the string does not appear in the displayed file and will not be written out if the file is saved. Function ``getNextTextMark'' is used to find text marks and retrieve the text string associated with them. Function ``deleteTextMarks'' will remove all existing text marks. Saving a file will also delete all existing text marks in the file. length is the number of bytes to insert stringOffset is the offset part of the address of the string to insert. stringSegment is the segment part of the address of the string to insert. If this is 0, the procedure converts it into the DS segment. hidden indicates whether this is a text mark or not. Use hidden=0 to insert a text string into the file. Use hidden=1 to insert a hidden text mark into the file.

insertCharacter(char ch) ch is inserted in front of the selection

deleteSelection() The selected characters are deleted.

(long)nextLinePos = readLine(long startPos, char *line) This function reads a line from the file in the active window. startPos is the character position of the first character to read in the line. line is the buffer the string read will be placed in. The line will be read to the next newline and the newline will be part of the returned string. nextLinePos is the character position after the line just read.

(char)ch = readOneChar(long charPosition) charPosition is the logical character position in the file of the character to read ch is the character at that position. ch = 0 if charPosition is less than 0 or equal to or greater than the size of the file

(int)eof = getSpan(long charPosition, long *firstByte, long *lastByte) charPosition is the logical character position in the file of the character to read firstByte is a FAR pointer to the buffer position where character(charPosition) is lastByte is a FAR pointer to the last buffer position after firstByte that contains valid characters from the file. eof is 1 when charPosition is at (or beyond) the end of the file.

(int)ch = readChar(long charPosition) This call uses function ``getSpan'' to read acharacter more quickly than ``readOneChar'' will. This call uses a cache that will be rendered invalid by ANY other interface calls (other than ``readChar''). If you make any other calls and then call ``readChar'' again you may get incorrect characters unless you call ``invalidateReadCache'' before calling ``readChar'' again. charPosition is the logical character position in the file of the character to read ch is the character read. If ch = -1, then charPosition was at (or beyond) the end of the file.

invalidateReadCache() This call invalidates the cache used in the above function ``readChar''.